<template>
  <view class="container">
		<view class="message-list">
			<view v-for="item in listData" :key="item.noticeId" class="message-item" @click="handleDetail(item)">
				<view class="message-title">{{ item.noticeTitle }}</view>
				<view class="message-time">{{ item.createTime }}</view>
			</view>
		</view>
  </view>
</template>

<script>
  import { getQueryNotice } from '@/api/home'
  export default {
    data() {
      return {
        listData: []
      }
    },
		async onLoad() {
			this.getList()
		},
    methods: {
			async getList() {
				const { data } = await getQueryNotice()
				this.listData = data
			},
			handleDetail(row) {
				this.$navigator(`/pages/message/detail?id=${row.noticeId}`)
			}
    },
		async onShareTimeline() {
			return {
				title: '柏圖教育',
				path: `/pages/message/list`
			}
		},
		async onShareAppMessage() {
			return {
				title: '柏圖教育',
				path: `/pages/message/list`
			}
		}
  }
</script>

<style lang="scss">
	.message-list {
		padding: 20rpx;
		.message-item {
			background-color: #fff;
			border-radius: 16rpx;
			padding: 20rpx;
			box-sizing: border-box;
			margin-bottom: 20rpx;
			.message-title {
				color: #333;
				font-size: 30rpx;
			}
			.message-time {
				padding-top: 20rpx;
				text-align: right;
				color: #999;
				font-size: 28rpx;
			}
		}
	}
</style>
